#ifndef NNE_UTIL_H_
#define NNE_UTIL_H_

#include <cstdlib>
#include <stdio.h>

#ifndef CHECK
#define CHECK(x)                                 \
  do {                                           \
    if (!(x)) {                                  \
      fprintf(stderr,                            \
              "Check failed: %s,from %s:%d\n",   \
              #x,__FILE__, __LINE__);            \
      exit(-1);                                  \
    }                                            \
  } while (0)

#define CHECK_MSG(x,message)                     \
  do {                                           \
    if (!(x)) {                                  \
      fprintf(stderr,                            \
              "Check failed: %s,from %s:%d\n",   \
              message,__FILE__, __LINE__);       \
      exit(-1);                                  \
    }                                            \
  } while (0)
#endif

#endif
